<?php

	class Account_model extends CI_Model {

		protected $__tbname = 'account';
		protected $__dbconf = 'default';

		var $id;	//int(11) unsigned	Primary Key	Auto Increment	NOT NULL
		var $code;	//varchar(15)	Unique Key		NOT NULL
		var $name;	//varchar(255)			NOT NULL
		var $id_user;	//int(11) unsigned			NOT NULL
		var $is_company_acc = 0;	//tinyint(1)			NOT NULL
		var $balance = 0;	//bigint(20)			NOT NULL
		var $actual_balance = 0;	//bigint(20)			NOT NULL
		var $deleted = 0;	//tinyint(1)			NOT NULL

		protected $__validation_rule = array(
			'id' => array('key' => 'PRI', 'type' => 'int', 'null' => FALSE, 'auto_increment' => TRUE),
			'code' => array('key' => 'UNI', 'type' => 'varchar', 'size' => 15, 'null' => FALSE),
			'name' => array('type' => 'varchar', 'size' => 255, 'null' => FALSE),
			'id_user' => array('type' => 'int', 'null' => FALSE),
			'is_company_acc' => array('type' => 'tinyint', 'null' => FALSE),
			'balance' => array('type' => 'bigint', 'null' => FALSE),
			'actual_balance' => array('type' => 'bigint', 'null' => FALSE),
			'deleted' => array('type' => 'tinyint', 'null' => FALSE)
		);

		protected $__relation = array(
			array('table' => 'user', 'foreign_key' => 'id_user')
		);
	}
